// const autoprefixer = require("autoprefixer");
const path = require('path');
const themePath = path.resolve(__dirname, 'src/assets/style/theme.less');
// const webpack = require("webpack");
let moment = require('moment')
const NAME = moment().format('YYYYMMDDHHmmss')
const Timestamp = new Date().getTime()
module.exports = {
    publicPath: '/h5/',
    lintOnSave: false,
    outputDir: '../RMC_H5_' + process.env.VUE_APP_PLANTFORM + '_Release_' + NAME,
    productionSourceMap:false,//去掉map文件
    // 配置css前缀,px转rem
    css: {
        loaderOptions: {
            less: {
                modifyVars: {
                    hack: `true; @import "${themePath}";`
                }
            },
        },
        extract: { // 打包后css文件名称添加时间戳
            filename: `css/[name].${Timestamp}.css`,
            chunkFilename: `css/[name].${Timestamp}.css`
        }
      
    },
    configureWebpack: {
        externals: {
            axios: "axios" // 配置使用CDN
        },
        entry: {
            // "babel-polyfill": "babel-polyfill",
            app: './src/main.js'
        },
        devtool: 'source-map',
        output: { // 输出重构  打包编译后的 文件名称  【模块名称.版本号(可选).时间戳】
            filename: `[name].${Timestamp}.js`,
            chunkFilename: `[name].${Timestamp}.js`
          }
    },
    devServer: {
        open: true,
        disableHostCheck: true,
        hot: true,
        inline: true,
        // 代理
        proxy: {
            // 只要请求地址有'api'都会匹配上
            "/api": {
                //  target:"https://gxjtsy.safetyhua.com/",
                // target: "http://192.168.16.120:8900/", //
                // target: "http://localhost:8000/",
                // target: "https://cy.safetyhua.com:8441/",
                // target: "http://chs.safetyhua.com/",
                // target: "http://chsyat.safetyhua.com/",
                // target: "https://ehs.syst.com.cn:8443/",

                // target: "http://120.79.182.233:8558/", //清哥IP

                // target: "http://qtyj.safetyhua.com/",
                // target: "http://txyj.safetyhua.com/",
                // target: "http://yq.safetyhua.com/",
                // target: "http://gckjy.safetyhua.com/",
                // target: "http://yq.safetyhua.com/",·
                // target:"http://pqyaqsafetyhua.com/"·,
                // target:"https://qyaq.safetyhua.com/",
                // target: "http://ggyj.yhtelecom.com/",
                // target: "https://qtbmapp.zatsafety.com/",
                // target: "https://hmbm.zatsafety.com/",
                // target: "http://192.168.3.2:8088/", //玉德IP
                // target: "http://cpyj.safetyhua.com/", //常平农事
                target: "http://sp.zatsafety.com/", //石排农事 石排码上学
                // target: "http://qtyj.safetyhua.com/", //石排农事 石排码上学
                // target: "http://qtyj.zatsafety.com/", //石排农事 石排码上学
                // target: "http://192.168.3.15:8000/", //石排农事 石排码上学
                // target: "http://192.168.3.2:8088/", //石排农事 石排码上学
                // target: "http://192.168.3.56:8000/", //
                // target: "https://fgbm.zatsafety.com/", //石排农事
                // target: "https://fgbmapp.zatsafety.com/", //石排农事
                ws: true,
                // 允许跨域
                changeOrigin: true,
                pathRewrite: {
                    "^/api": "/api" //通过pathRewrite重写地址，将前缀/api转为/
                }
            },
            "/Assets": {
                // target: "https://gxjtsy.safetyhua.com/",
                // target: "http://192.168.138.167:8900/",
                // target: "http://192.168.138.167:8000/",//
                // target: "http://localhost:8000/",
                // target: "http://qtyj.safetyhua.com/",
                // target: "http://chsyat.safetyhua.com/",
                // target: "https://ehs.syst.com.cn:8443/",
                // target: "http://ggyj.yhtelecom.com/",
                // target: "http://120.79.182.233:8558/",
                target: "http://cpyj.safetyhua.com/", //常平农事
                ws: true,
                // 允许跨域
                changeOrigin: true,
            },
            "/Plugins": {
                // target: "https://gxjtsy.safetyhua.com/",
                //target: "http://192.168.138.167:8900/",
                // target: "http://192.168.138.167:8000/",//
                // target: "http://localhost:8000/",
                // target: "http://qtyj.safetyhua.com/",
                // target: "http://chsyat.safetyhua.com/",
                // target: "https://ehs.syst.com.cn:8443/",
                // target: "http://ggyj.yhtelecom.com/",
                // target: "http://120.79.182.233:8558/",
                target: "http://cpyj.safetyhua.com/", //常平农事
                ws: true,
                // 允许跨域
                changeOrigin: true,
            },
            "/admin-api": {
                target: "http://47.113.217.249:8008/",
                changeOrigin: true,
            }
        }
    },

};